<template>
  <view class="container">
   <!-- <view class="navbar u-f-ajc">
      <image src="/static/jibei/home/back.png" class="abso_back" mode="widthFix"
        @click="$u.route({type: 'back', delta: 1})"></image>
      <image src="/static/jibei/details/tihuoquan.png" mode="widthFix"></image>
    </view>
 -->
    <view class="content">
      <scroll-view scroll-y class="scroll_box">
        <view class="item_list">
          <view class="items items2 u-f-ac">
            <view class="u-f-ajc" style="width: 45%;">时间</view>
            <view class="u-f-ajc" style="width: 25%;">数量</view>
            <view class="u-f-ajc" style="width: 30%;">来源</view>
          </view>
          <view class="items u-f-ac" @click="toarticlexq(value.projectid)" v-for="(value,key) in out_log" :key="key">
            <view class="u-f-ajc" style="width: 45%;">{{value.time}}</view>
            <view class="u-f-ajc" style="width: 25%;">{{value.num}}</view>
            <view class="u-f-ajc" style="width: 30%;">{{value.common}}</view>
          </view>
        </view>
      </scroll-view>
    </view>

    <tabbars :current="2"></tabbars>
  </view>
</template>

<script>
  import uniLoadMore from '../../../../components/uni-load-more.vue';
  export default {
    components: {
      uniLoadMore
    },
    data() {
      return {
        openid: '',
        out_log: [],
        jfz: '',
        jfz_out: '',
        code: '',
        page: 1,
      }
    },
    onLoad: function(e) {
      uni.showLoading()
      uni.getStorage({
        key: 'openid',
        success: (res) => {
          this.openid = res.data
          this.getdata()
          // this.getdata2()
          //页面一加载时请求一次数据`
          uni.hideLoading()
        },
        fail: () => {
          uni.navigateTo({
            url: '../login/login'
          });
        }
      });
    },
    methods: {
      getdata() {
        uni.request({
          url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=api.index.get_zctwo_list&app=1',
          method: 'POST',
          data: {
            'openid': this.openid,
            'page': this.page,
          },
          header: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          success: (res) => {
            console.log(res)

            this.yue = res.data.total
            if (res.data.error == 1) return this.$u.toast(res.data.message)
            if (res.data.error == 0) this.out_log.push(...res.data.list)

            // this.code = res.data.error
          },
          fail: () => {},
          complete: () => {}
        });
      },
      reachBottom() {
        console.log('下拉')
        this.page += 1
        this.getdata();
      },


      obtain() {
        uni.navigateTo({
          url: 'obtain/obtain?type=' + 1
        })
      },
      // getdata2(){
      // 	uni.request({
      // 		url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=tzz.index.thq_index&app=1',
      // 		method: 'POST',
      // 		data: {'openid':this.openid},
      // 		header:{'Content-Type':'application/x-www-form-urlencoded'},
      // 		success:(res) => {
      // 			// console.log(res)
      // 			this.jfz_out = res.data.list
      // 			this.jfz = res.data.jfz
      // 		},
      // 		fail: () => {},
      // 		complete: () => {}
      // 	});
      // },
    },
  }
</script>

<style lang="scss">
  page {
    background-color: #B5C3C7;
  }

  .container {
    width: 100%;
    height: 100vh;
    // background: url(/static/jibei/home/home_bg.png) no-repeat 0 0;
    background-size: cover;
    box-sizing: border-box;
  }

  .navbar {
    width: 100%;
    padding: 140rpx 0 0;

    image {
      width: 80%;
    }
  }

  .content {
    margin-top: 60rpx;
    padding: 0 0 100rpx;
  }

  .scroll_box {
    width: 100%;
    height: 1210rpx;
    // background: url(/static/jibei/details/kuang.png) no-repeat 0 0;
    background-size: cover;
    box-sizing: border-box;
    padding: 64rpx 80rpx 50rpx;

    .item_list {
      .items {
        height: 90rpx;
        box-sizing: border-box;

        view {
          color: #FFFFFF;
          font-size: 24rpx;
        }
      }

      .items2 {
        view {
          font-size: 28rpx;
        }
      }

    }
  }
</style>
